﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace CoderJoe.Xml
{
    internal static class XmlConverter
    {
        internal static TResult GetValue<TResult>(string value)
        {
            return (TResult)GetValue(typeof(TResult), value, default(TResult));
        }

        internal static object GetValue(Type returnType, string value, object defaultValue)
        {
            if (returnType == typeof(string))
            {
                return value;
            }
            else if (returnType == typeof(int))
            {
                return XmlConvert.ToInt32(value);
            }

            return defaultValue;
        }
    }
}
